home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-04
/
bipl.zip
/
PROGS.ZIP
/
FNCTMPL.ICN
< prev
next >
Wrap
Text File
|
1992-09-28
|
2KB
|
67 lines
############################################################################
#
# File: fnctmpl.icn
#
# Subject: Program to produce function templates
#
# Author: Ralph E. Griswold
#
# Date: February 27, 1992
#
###########################################################################
#
# This program processes the rt.db database for the Icon compiler produced
# by rtt and produces procedures for each Icon function to be used by
# iftrace.icn.
#
# The data base is expected from standard input.
#
############################################################################
procedure main()
local line, header, proto, rettype, name, varargs
while line := read() do
line ? {
if pos(0) then {
header := read() | stop("eof")
proto := read() | stop("eof")
header ? {
if ="$endsect" then exit()
tab(upto('{'))
tab(upto(',') + 1)
if =("*" | "1+") then rettype := "suspend"
else rettype := "return"
}
proto ? {
="\"" | next
name := tab(bal(' ')) | stop("bad proto")
name := trim(name,',')
name ?:= {
map(move(1),&lcase,&ucase) || tab(0)
}
name ?:= {
if find("...") then {
varargs := 1
tab(upto('(') + 1) || "x[])"
}
else {
varargs := &null
tab(0)
}
}
}
write("procedure ",name)
if /varargs then write(" ",rettype," ",name)
else {
name ?:= {
tab(upto('('))
}
write(" ",rettype," ",name," ! x")
}
write("end\n")
}
else if ="$endsect" then exit()
}
end